An image processing technology is provided in which a multi-level image (a gray-scale image) is binarized, and is converted to a binarized image, a sign such as a barcode, or two-dimensional data code is decoded from the binarized image, or characters are recognized. In the technology, it is required to select an appropriate binarized threshold value. In general, a method is used in which a binarized threshold value is selected by a maximum likelihood threshold selection method, using a gray level histogram.
As one of the maximum likelihood threshold selection methods, there is Otsu's threshold selection method. In this selection method, it is assumed that a gray level value of a target region, and the gray level value of a background in the multi-level image both follow a normal variance. For this reason, there is a problem in that it is difficult to obtain an appropriate binarized threshold value when the variance of a grayscale value of the target region, and the variance of the grayscale value of the background are extremely different, or when the number of pixels in the target region, and the number of pixels in the background region are extremely different.